<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" %>
  <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>XX系统 - 房屋信息管理</title>
	<link rel="stylesheet" href=" ${pageContext.request.contextPath}/css/main.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/lib/font-awesome/css/font-awesome.css">
</head>
<style>
	#mess{
	color:red;
	}
</style>
<body>
<div class="box">
	<h3>房屋信息管理</h3>
	<div class="actions">
		<div>
			<a class="btn btn-primary" href="${pageContext.request.contextPath}/view/flats/add.jsp">添加房屋信息</a>
		</div>
	</div>

	<table class="list">
		<tr>
			<th>序号</th>
			<th>所属地区</th>
			<th>所属小区</th>
			<th>单元号</th>
			<th>所属楼层</th>
			<th>房间号</th>
			<th>面积</th>
			<th>朝向</th>
			<th>限住人数</th>
			<th>出租价格(元)</th>
			<th>出租状态</th>
			<th>操作</th>
		</tr>
		<c:forEach items="${pageBean.data }" var="list"  varStatus="state">
		<tr>
			<td>${state.index+1 }</td>
			<td>${list.h_area }</td>
			<td>${list.h_estate }</td>
			<td>${list.h_unitNumber}</td>
			<td>${list.h_floor}</td>
			<td>${list.h_roomNo}</td>
			<td>${list.h_acreage}</td>
			<td>${list.h_direction}</td>
			<td>${list.h_limit}</td>
			<td>${list.h_price}</td>
			<td>${list.h_status==1?'已出租':list.h_status==2?'未出租':'停止出租'}</td>
			<td>
				<!-- <a class="fa fa-info" title="详情" href="detail.jsp"></a> -->
				 <a class="fa fa-info" title="详情" href="${pageContext.request.contextPath}/detailHouseServlet?h_id=${list.h_id }"></a>
				&nbsp;&nbsp;
				<a class="fa fa-pencil" title="编辑" href="${pageContext.request.contextPath}/editHouseServlet?action=editShow&h_id=${list.h_id }"></a>
				&nbsp;&nbsp;
				<a class="fa fa-remove" title="删除" href="${pageContext.request.contextPath}/deleteHouseServlet?h_id=${list.h_id }" onclick="return confirmDelete(1)"></a>
			</td>
		</tr>
			</c:forEach>
	</table>
	<div class="pager-info">
		<div>共有 ${pageBean.totalCount } 条记录，第 ${pageBean.currentPage }/${pageBean.pageCount }页&nbsp;&nbsp;&nbsp;&nbsp;<span id="mess">${mess }</span> </div>
		<div>
			<ul class="pagination">
				<li class="paginate_button previous disabled }">
				<c:if test="${pageBean.currentPage!=1 }">
				<a href="${pageContext.request.contextPath}/findHouseServlet?currentPage=${pageBean.currentPage-1 }">上一页</a>
				</c:if>
				</li>
				<li class="paginate_button active"><a href="${pageContext.request.contextPath}/findHouseServlet?pageNum=${pageBean.currentPage }">${pageBean.currentPage }</a></li>
				<li class="paginate_button next disabled">
				<c:if test="${pageBean.currentPage!=pageBean.pageCount}">
				<a href="${pageContext.request.contextPath}/findHouseServlet?currentPage=${pageBean.currentPage+1 }">下一页</a>
				</c:if>
				</li>
			</ul>
		</div>
	</div>
</div>
<c:remove var="mess" scope="session"/>
<script src="${pageContext.request.contextPath}/lib/jquery/jquery.js"></script>
<script>
function confirmDelete(id){
	if (confirm("确定要删除码？")) {
		alert('发送删除请求，刷新页面（不要异步）');
		return true;
	}
	return false;
}
</script>
</body>
</html>